package com.example.a12138.myapplication.fragment;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.example.a12138.myapplication.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class RealinfoFragment extends Fragment implements View.OnClickListener{
    private TextView tv;
    private Button btn;

    public RealinfoFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_realinfo, container, false);
        tv=view.findViewById(R.id.tv);
        btn=view.findViewById(R.id.btn);
            /*btn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Toast.makeText(getActivity(), "竹鼠的单价是"+tv.getText().toString(),Toast.LENGTH_SHORT).show();
                }
            });*/
            btn.setOnClickListener(this);
            return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
    }

    @Override
    public void onClick(View view) {
        Toast.makeText(getActivity(), "钥匙的单价是"+tv.getText().toString(),Toast.LENGTH_SHORT).show();
    }
}
